package kr.co.doriclassic.powerjava.chapter12.interfaceex;

public class Box implements Comparable {
	private double volume;
	public Box(double volume) {
		this.volume = volume;
	}

	@Override
	public int CompareTo(Object other) {
		
		return (int)(this.volume-((Box)other).volume);
	}

	public static void main(String[] args) {
		Box b1 = new Box(100);
		Box b2 = new Box(85.0);
		
		if(b1.CompareTo(b2)>0){
			System.out.println("b1이 크다.");
		}
		else if(b1.CompareTo(b2)<0){
			System.out.println("b2가 큼");
		}
		else{
			System.out.println("b1과 b2는 같음");
		}
	}
}
